package com.aliang.service;

import org.springframework.beans.factory.annotation.Autowired;

import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

public class RedisServiceDemo {

	@Autowired
	ShardedJedisPool shardedRedisPool;

	public void set(String key,String value){
		
		ShardedJedis shardedJedis = shardedRedisPool.getResource();
		
		shardedJedis.set(key, value);
		
		shardedJedis.close();
		
	}
	

	public String get(String key){
		
		ShardedJedis shardedJedis = shardedRedisPool.getResource();
		
		String value =  shardedJedis.get(key);
		
		shardedJedis.close();
	
		return value ;
		
	}
	
}
